package com.prj.ufdm.cloud.ms.order.api.createorder;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.prj.ufdm.cloud.ms.order.dao.createorder.CreateOrderDao;
import com.prj.ufdm.cloud.ms.order.model.createorder.CreateOrder;

/**
 * DESC: 库存管理 <br>
 * @author 胡义振
 * @date 2020年2月23日
 */
@RestController
@RequestMapping("/api/order/create")
public class CreateOrderApi {
	
	@Autowired
	private CreateOrderDao createOrderDao;
	
	@RequestMapping("/list")
	@ResponseBody
	public List<CreateOrder> getNewsList(CreateOrder createOrder) {
		return createOrderDao.selectCreateOrderList(createOrder);
	}
	
	@RequestMapping("/add")
	@ResponseBody
	public int saveNews(CreateOrder createOrder) {
		createOrder.setId(UUID.randomUUID().toString().replaceAll("-", "").toUpperCase());
		return createOrderDao.insertCreateOrder(createOrder);
	}
	
	@RequestMapping("/update")
	@ResponseBody
	public int modifyNews(CreateOrder createOrder) {
		return createOrderDao.updateCreateOrder(createOrder);
	}
	
	@RequestMapping("/del")
	@ResponseBody
	public int removeNews(String id) {
		return createOrderDao.deleteCreateOrder(id);
	}
	

}
